package com.example.sprinbootdemo.service.impl;

import com.example.sprinbootdemo.entity.CarModel;
import com.example.sprinbootdemo.mapper.CarModelMapper;
import com.example.sprinbootdemo.service.CarModelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CarModelServiceImpl implements CarModelService {

    @Autowired
    private CarModelMapper carModelMapper;

    @Override
    public List<CarModel> getAllCarModels() {
        return carModelMapper.selectAll();
    }

    @Override
    public void addCarModel(CarModel carModel) {
        carModelMapper.addCarModel(carModel);
    }

    @Override
    public void deleteCarModelByModelId(int modelId) {
        carModelMapper.deleteCarModelByModelId(modelId);
    }

    @Override
    public void updateCarModelByModelId(CarModel carModel) {
        carModelMapper.updateCarModelByModelId(carModel);
    }

    @Override
    public CarModel getCarModelByModelId(int modelId) {
        return carModelMapper.getCarModelByModelId(modelId);
    }
}